import request from '@/utils/request'

/**
 * 用户资料相关API
 */

// 获取用户资料
export function getUserProfile(params) {
  return request({
    url: '/api/userProfile/get.do',
    method: 'get',
    params
  })
}

// 更新用户资料
export function updateUserProfile(data) {
  return request({
    url: '/api/userProfile/update.do',
    method: 'post',
    data,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  })
}

// 修改密码
export function changePassword(data) {
  return request({
    url: '/api/userProfile/changePassword.do',
    method: 'post',
    data,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  })
}

// 上传头像
export function uploadAvatar(data) {
  return request({
    url: '/api/userProfile/uploadAvatar.do',
    method: 'post',
    data,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  })
}

// 检查资料完整性
export function checkProfileCompleteness(params) {
  return request({
    url: '/api/userProfile/checkCompleteness.do',
    method: 'get',
    params
  })
}

// 获取账户安全信息
export function getSecurityInfo(params) {
  return request({
    url: '/api/userProfile/securityInfo.do',
    method: 'get',
    params
  })
}

// 验证用户身份
export function verifyIdentity(data) {
  return request({
    url: '/api/userProfile/verifyIdentity.do',
    method: 'post',
    data,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  })
}

// 获取资料完善建议
export function getProfileSuggestions(params) {
  return request({
    url: '/api/userProfile/suggestions.do',
    method: 'get',
    params
  })
}

// 获取安全日志
export function getSecurityLogs(params) {
  return request({
    url: '/api/userProfile/securityLogs.do',
    method: 'get',
    params
  })
}
